package com.beta.em.transacrion;

import java.util.Objects;

/**
 * Created by lichao on 2016/11/28.
 */
public enum TransactionSubject {

    PAYOUT("payout","支付"),
    REFUND("refund","退款"),
    SETTLE("settle","结算");

    private String value;
    private String cnValue;

    public String getValue() {
        return this.value;
    }

    public String getCnValue() {
        return this.cnValue;
    }

    private TransactionSubject(String value, String cnValue) {
        this.value = value;
        this.cnValue = cnValue;
    }
    public static TransactionSubject getSubject(String value) {
        for (TransactionSubject humenStates: values()) {
            if (humenStates.getValue().equals(value)) {
                return humenStates;
            }
        }
        return null;
    }

    public static String getCnValue(String value) {
        TransactionSubject subject = getSubject(value);
        if (Objects.nonNull(subject)) {
            return subject.getCnValue();
        } else {
            return "";
        }
    }
}
